<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script type="text/javascript">
        function Person(name, age, gender) {
            this.name = name;
            this.age = age;
            this.gender = gender;
        }
        per1.toString = function() {
            return (
                "Person[name=" +
                this.name +
                ",age=" +
                this.age +
                ",gender=" +
                this.gender +
                "]"
            );
        };
        var per1 = new Person("smyh", 26, "男");

        var per2 = new Person("vae", 30, "男");

        console.log("per1 = " + per1);
        console.log("per2 = " + per2.toString());
    </script>
</body>

</html>